const {resolve} = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: './src/index.js',
  output: {
    path: resolve(__dirname,'build'),
    filename: "bundle.js"
  },
  module: {
    rules: [
      {
        test: /\.js$/ ,
        /*
        eslint,使用Airbnb配置,需要安装以下依赖：
          ---- eslint eslint-loader eslint-config-airbnb-base eslint-plugin-import
        设置规则: .eslintrc添加:
        {
          "extends": "airbnb-base"
        }
         */
        exclude: /node_modules/,  // 排除第三方库的eslint检查
        loader: 'eslint-loader',
        options: {
          fix: true,  // 自动修复
        }
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./src/index.html"
    }),
  ],
  mode: "development"
}